<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>成都博物馆内容管理平台</title>
    <link rel="stylesheet" href="../css/ext/bootstrap.min.css">
    <link rel="stylesheet" href="../css/common/base.css">
    <script src="../js/ext/jquery-1.11.3.js"></script>
    <script src="../js/ext/jquery-ui.min.js"></script>
    <script src="../js/ext/bootstrap.min.js"></script>
    <script src="../js/base.js"></script>
</head>
<body>
<% include ../common/header.jsp %>
<div class="main">
    <% include ../common/menu.jsp %>
    <div class="main-content">
        <div class="wrapper">
            <div class="content-title">
                <!--面包屑-->
                <ol class="breadcrumb">
                    <li>内容管理</li>
                    <li>展品管理</li>
                    <li class="active">编辑</li>
                </ol>
            </div><!--content-title-->
            <form action="" method="post">
                <div class="form-list">
                    <label class="l80"><i class="ic ic-dotred"></i>名称</label>
                    <input id="name" class="i280" type="text" name="" maxlength="30">
                    <em>不超过30个字符，可由中英文数字及中英文符号组成</em>
                </div>
                <div class="form-list">
                    <label class="l80 pl16">音频地址</label>
                    <input id="radio" class="i280" type="text" name="">
                    <em></em>
                </div>
                <div class="form-list">
                    <label><i class="ic ic-dotred"></i>展品简介</label>
                    <input id="zpjj" class="i280" type="text" name="">
                    <em></em>
                </div>
                <div class="form-list textarea">
                    <label class="l80 pl16">文字说明</label>
                    <!-- 加载编辑器的容器 -->
                    <script id="editor" name="content" type="text/plain" style="width:700px;height:300px;"></script>
                    <!-- 配置文件 -->
                    <script type="text/javascript" src="../js/ext/ueditor/ueditor.config.js"></script>
                    <!-- 编辑器源码文件 -->
                    <script type="text/javascript" src="../js/ext/ueditor/ueditor.all.js"></script>
                    <!-- 实例化编辑器 -->
                    <script type="text/javascript">
                        var ue = UE.getEditor('editor', {
                            autoHeightEnabled: false,
                        });
                    </script>
                    <em style="margin-left: 88px"><i class="ic ic-warn"></i></em>
                </div>
                <div class="form-list textarea">
                    <label class="l80 pl16">备注</label>
                    <textarea id="remark" class="t594" name=""></textarea>
                    <em>不超过200个字符</em>
                </div>
                <div class="form-list" style="margin-left: 88px;width: 880px">
                    <a id="relate" class="btn btn-relate" href="/exhibitsRelate"><span>关联内容</span></a>
                    <input class="btn pull-right" id="sort" type="button" value="排序">
                    <input class="btn pull-right" id="cancel-sort" type="button" value="取消排序" style="display: none">
                    <div class="list-relate" id="sortable">
                        <% for(var i=1; i<9; i++) {%>
                        <ul class="relate-item">
                            <li class="relate-id">E12345612<%= i %></li>
                            <li class="relate-name">2015年度四川省文化馆党建工作述职情况报告2015年度四川省文化馆党建工作述职情况报告</li>
                            <li class="relate-img"><img src="../images/base/img-item.jpg" alt=""></li>
                            <li class="relate-time">8888-88-88</li>
                            <li class="relate-operate">
                                <a href="javascript:;"><i class="ic ic-remove"></i></a>
                            </li>
                        </ul>
                        <% } %>
                    </div>
                </div>
                <div style="margin-left: 88px">
                    <input id="tijiao" class="btn btn-submit" type="button" value="提交">
                    <a class="btn btn-cancel" style="margin-left: 40px"><span>取消</span></a>
                </div>
            </form>
        </div><!--wrapper-->
    </div><!--main-content-->
</div>
<script>
    $(function () {
        /**关联列表排序功能*/
        list_sort();
        /**验证音频地址为空或者32为数字**/
        function check_radio() {
            var strRegex = "^[0-9]*$";
            var re = new RegExp(strRegex);
            var tar = $('#radio');
            var str = tar.val();
            if (str == '') {
                tar.parent().find('em').html('').show();
                return true
            } else {
                if (re.test(str) && str.length == 32) {
                    tar.parent().find('em').html('<i class="ic ic-right">').show();
                    return true
                } else {
                    tar.parent().find('em').html('<i class="ic ic-warn"></i>请填入正确的32位视频CODE').show();
                    return false
                }
            }
        }

        /**展品简介验证*/
        function check_zpjj() {
            var tar = $('#zpjj');
            var val = tar.val();
            if ($.trim(val) == '') {
                tar.parent().find('em').html('<i class="ic ic-warn"></i>展品简介不能为空').show();
                return false
            } else {
                tar.parent().find('em').html('<i class="ic ic-right">').show();
                return true
            }
        }

        $('#radio').blur(function () {
            check_radio();
        });
        $('#zpjj').blur(function () {
            check_zpjj();
        });
        /* 关联 */
        $('#relate').click(function () {
//            $('form').attr('action', '../exhibit/loadRelateInfo');
//            $('#relate').val('跳转中...').attr('disabled',true);
//            setTimeout("$('#relate').val('关联内容').attr('disabled',false)",300);
//            $('form').submit();
        });
        /*提交时验证*/
        $('#tijiao').click(function () {
//            $('form').attr('action', '../exhibit/saveorEditExhibit');
            var mark = 0;
            if (check_radio())mark++;
            if (check_zpjj())mark++;
            if (check_remark())mark++;
            if (check_relate())mark++;
            if (mark == 5) {
                $('#submit').val('提交中...').attr('disabled', true);
                setTimeout("$('#submit').val('提交').attr('disabled',false)", 300);
//                $('form').submit();
            }
        })
    })
</script>
</body>
</html>